package demo6;
import java.time.LocalDate;

//获取某年的父亲节和母亲节的日期
//母亲节5月的第2个星期天

public class Festival02 {
    public static void main(String[] args) {
        System.out.println(getFatherDay(2021));//5-9
        System.out.println(getFatherDay(2020));//5-10
    }
    public static LocalDate getFatherDay(int year) {
        LocalDate d = LocalDate.of(year, 5, 1);
        int w = d.getDayOfWeek().getValue();//1-7 周一-周日
        if(w==7) {
            d = d.plusDays(7);
        }else {
            d = d.plusDays(14-w);
        }
        return d;
    }
}
